package com.police.web.controller.sjgl;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.police.system.domain.sjgl.TToolsAjxx;
import com.police.system.service.sjgl.ITToolsAjxxService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.police.common.annotation.Log;
import com.police.common.core.controller.BaseController;
import com.police.common.core.domain.AjaxResult;
import com.police.common.enums.BusinessType;
import com.police.common.utils.poi.ExcelUtil;
import com.police.common.core.page.TableDataInfo;

/**
 * 案件基本信息Controller
 * 
 * @author ruoyi
 * @date 2024-05-24
 */
@RestController
@RequestMapping("/system/ajxx")
public class TToolsAjxxController extends BaseController
{
    @Autowired
    private ITToolsAjxxService tToolsAjxxService;

    /**
     * 查询案件基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:ajxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(TToolsAjxx tToolsAjxx)
    {
        startPage();
        List<TToolsAjxx> list = tToolsAjxxService.selectTToolsAjxxList(tToolsAjxx);
        return getDataTable(list);
    }

    /**
     * 导出案件基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:ajxx:export')")
    @Log(title = "案件基本信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TToolsAjxx tToolsAjxx)
    {
        List<TToolsAjxx> list = tToolsAjxxService.selectTToolsAjxxList(tToolsAjxx);
        ExcelUtil<TToolsAjxx> util = new ExcelUtil<TToolsAjxx>(TToolsAjxx.class);
        util.exportExcel(response, list, "案件基本信息数据");
    }

    /**
     * 获取案件基本信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ajxx:query')")
    @GetMapping(value = "/{jlbh}")
    public AjaxResult getInfo(@PathVariable("jlbh") String jlbh)
    {
        return success(tToolsAjxxService.selectTToolsAjxxByJlbh(jlbh));
    }

    /**
     * 新增案件基本信息
     */
    @PreAuthorize("@ss.hasPermi('system:ajxx:add')")
    @Log(title = "案件基本信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TToolsAjxx tToolsAjxx)
    {
        return toAjax(tToolsAjxxService.insertTToolsAjxx(tToolsAjxx));
    }

    /**
     * 修改案件基本信息
     */
    @PreAuthorize("@ss.hasPermi('system:ajxx:edit')")
    @Log(title = "案件基本信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TToolsAjxx tToolsAjxx)
    {
        return toAjax(tToolsAjxxService.updateTToolsAjxx(tToolsAjxx));
    }

    /**
     * 删除案件基本信息
     */
    @PreAuthorize("@ss.hasPermi('system:ajxx:remove')")
    @Log(title = "案件基本信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jlbhs}")
    public AjaxResult remove(@PathVariable String[] jlbhs)
    {
        return toAjax(tToolsAjxxService.deleteTToolsAjxxByJlbhs(jlbhs));
    }
}
